import service from '@/axios/index.js'


// 获取城市定位
export const fetchCityPosition = () => {
    return service.get('https://v2.sohu.com/weather-location/weather/weatherdata')
}


// 城市列表
export const fetchCityList = () => {
    return service.get('/city-area.json')
}


// 顺序练习
export const fetchSequence = (carType, course, cityCode) => {
    return service.get(`/exercise/sequence?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}


//章节列表
export const fetchChapters = (carType, course, cityCode) => {
    return service.get(`/exercise/chapters?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}

// 章节练习
export const fetchChapter = (id, carType, course, cityCode) => {
    return service.get(`/exercise/chapter/${id}?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}


// 随机练习
export const fetchRandom = (carType, course, cityCode) => {
    return service.get(`/exercise/random?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}


// 难题训练
export const fetchDifficulty = (carType, course, cityCode) => {
    return service.get(`/exercise/difficulty?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}

// 强化列表(专项列表)
export const fetchStrengthens = (carType, course, cityCode) => {
    return service.get(`/exercise/strengthens?carType=${carType}&course=${course}&cityCode=${cityCode}`)
}

//强化训练(专项学习)
export const fetchStrengthen = (id, carType, course, cityCode, strengthenId) => {
    return service.get(`/exercise/strengthen/${id}?carType=${carType}&course=${course}&cityCode=${cityCode}&strengthenId=${strengthenId}`)
}

//试题详情(单个试题)
export const fetchQuestion = (questionId) => {
    return service.get(`/question?ids=${questionId}`)
}

//试题详情(多个试题)
export const fetchQuestions = (questionIds) => {
    const idsParam = questionIds.join(',');
    return service.get(`/question?ids=${idsParam}`)
}